import { lazy } from "react";
import { FriendsO, HomeO, Search, SettingO } from '@react-vant/icons';

export let mainRouter=[
    {
        path: '/home/shou',
        element: lazy(() => import('../views/home/Shou')),
        title: '首页',
        icon:<FriendsO/>
    },
    {
        path: '/home/classift',
        element: lazy(() => import('../views/home/Classify')),
        title: '分类',
        icon:<HomeO/>
    },
    {
        path: '/home/cart',
        element: lazy(() => import('../views/home/Cart')),
        title: '购物车',
        icon:<Search/>
    },
    {
        path: '/home/my',
        element: lazy(() => import('../views/home/My')),
        title: '我的',
        icon:<SettingO/>
    }
]
const routes = [
    
    {
        path: '/home',
        element: lazy(()=> import('../views/Home')),
        title: '首页',
        children:mainRouter
    },
    {
        path: '/login',
        element: lazy(()=>{import('../views/Login')}),
        title: '登录'
    },
    {
        path: '/nologin',
        element: lazy(()=>{import('../views/NoLogin')}),
        title: '没有登录'
    },
    {
        path: '/detail/:id',
        element: lazy(()=>{import('../views/Detail')}),
        title: '详情页面'
    },
    {   
        from:'/',
        to: '/home/shou' // 重定向:重新指向其它path,会改变网址
    }
]

export default routes